home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
626-650
/
634
/
apig
/
apig33.lzh
/
e6_requesters.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-01-26
|
5KB
|
157 lines
/* Example Using Requesters */
/* */
x = addlib("apig.library",0,-30,0)
portname = "examplereq6_port"
p = openport(portname)
call set_apig_globals()
scrtitle = "Hey Buddy, Yea You, This is Your New Screen !"
wintitle = "This is your title"
winidcmp = CLOSEWINDOW+MENUPICK
winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWSIZING+WINDOWDEPTH+GIMMEZEROZERO+ACTIVATE
scr = openscreen(0,0,640,400,3,4,5,LACE+HIRES,CUSTOMSCREEN,scrtitle)
/* open window */
call setrgb4(scr,0,3,3,3)
call setrgb4(scr,1,0,0,0)
call setrgb4(scr,2,0,0,7)
call setrgb4(scr,3,15,15,0)
call setrgb4(scr,4,15,5,1)
call setrgb4(scr,5,0,8,15)
call setrgb4(scr,6,0,15,0)
call setrgb4(scr,7,6,5,4)
w1 = openwindow(portname,0,0,640,400,2,4,winidcmp,winflags,wintitle,scr,0,0,0)
rpw1 = getwindowrastport(w1)
menustrip1 = makemenu(w1,"PICK ONE OF THESE",0,0,MENUENABLED,0)
m0 = makeitem(w1,"UGLY SYSTEM REQUESTER",menustrip1,0,4,0,0,0,0,'A',6,3,JAM1,0,0)
m1 = makeitem(w1,"MY LITTLE REQUESTER ",menustrip1,0,40,0,0,0,0,'A',6,3,JAM1,0,0)
call setmenustrip(w1,menustrip1)
menuitem0 = menunumber(menustrip1,menustrip1,m0,0)
menuitem1 = menunumber(menustrip1,menustrip1,m1,0)
/* My Little Requester */
g1 = makestrgadget(w1,20,50,320,11,GADGHCOMP,RELVERIFY+ENDGADGET,0,5,0,0,22,0,100)
z = setstrgad(g1,"Enter Something into this gadget")
gix = makeitext(w1,"END REQ",AUTOLEFTEDGE,AUTOTOPEDGE,0,3,JAM2,0,0)
gix1 = makeitext(w1,"THIS GADGET ENDS THE REQUEST",90,AUTOTOPEDGE,5,1,JAM2,0,gix)
g2 = makeboolgadget(w1,10,90,67,12,GADGHCOMP,GADGIMMEDIATE+ENDGADGET,gix,5,0,0,26,g1)
giy = makeitext(w1,"WON'T END IT",AUTOLEFTEDGE,AUTOTOPEDGE,1,5,JAM2,0,0)
giy1 = makeitext(w1,"THIS GADGET DOES NOT END THE REQUEST",120,AUTOTOPEDGE,4,2,JAM2,0,giy)
g3 = makeboolgadget(w1,10,110,106,12,GADGHCOMP,GADGIMMEDIATE,giy,5,0,0,27,g1)
giz = makeitext(w1,"WILL FORCE ENDREQ",AUTOLEFTEDGE,AUTOTOPEDGE,0,3,JAM2,0,0)
giz1 = makeitext(w1,"THIS GADGET CALLS ENDREQUEST() ",160,AUTOTOPEDGE,7,3,JAM2,0,giz)
g4 = makeboolgadget(w1,10,130,145,12,GADGHCOMP,GADGIMMEDIATE,giz,5,0,0,28,g1)
/* the left & top edge of the itext is relative to the requester */
i1x = makeitext(w1,"This is Your Requester Buddy",10,10,3,2,JAM2,0,0)
/* itext below gets linked to the one above */
call makeitext(w1," The String Gadget Above Ends the Requester",20,70,3,2,JAM2,0,i1x)
req = makerequester(w1,20,20,450,150,g1,i1x,0,4,0,0,0,0)
/* DMRequester */
reqbitmap = loadiff("req6bitmap",w1)
reqwidth = iffwidth(reqbitmap)
reqheight = iffheight(reqbitmap)
req2g1 = makeboolgadget(w1,0,0,reqwidth,reqheight,GADGHCOMP,GADGIMMEDIATE+ENDGADGET,0,5,0,0,128,0)
req2 = makerequester(w1,0,0,reqwidth,reqheight,req2g1,0,0,6,POINTREL+PREDRAWN,0,0,reqbitmap)
call makeitext(w1,"This is Your Requester Buddy",10,10,1,2,JAM2,0,req2)
x = setdmrequest(w1,req2)
/* --- auto request text --- */
bodytext = makeitext(w1,"This is Your Requester Buddy",10,10,1,5,JAM2,0,0)
call makeitext(w1," Use one of the gadgets below ",10,21,1,5,JAM2,0,bodytext)
call makeitext(w1," to end this requester",10,32,1,5,JAM2,0,bodytext)
yestext = makeitext(w1," YES ",AUTOLEFTEDGE,AUTOTOPEDGE,AUTOFRONTPEN,AUTOBACKPEN,AUTODRAWMODE,0,0)
notext = makeitext(w1," NO ",AUTOLEFTEDGE,AUTOTOPEDGE,AUTOFRONTPEN,AUTOBACKPEN,AUTODRAWMODE,0,0)
z = pitext(rpw1,50,50,"This is an example of using requesters",5,2,JAM2,0)
z = pitext(rpw1,50,80," select a Requester from the MENU",5,2,JAM2,0)
z = pitext(rpw1,50,110," ... or you can double-click the mouse Menu-Button",5,2,JAM2,0)
exitme = 0
do forever
x = waitpkt(portname)
do forever
msg = '0000 0000'x
msg = getpkt(portname)
if msg = '0000 0000'x then leave
class = getarg(msg,0)
if class = CLOSEWINDOW then exitme = 1
if class = MENUPICK then
do
menselect = getarg(msg,1)
x = reply(msg,0)
if menselect = menuitem1 then
do
Y = request(req,w1)
if Y = 1 then call getreqresponse()
end
else
if menselect = menuitem0 then
do
Y = autorequest(w1,bodytext,yestext,notext,0,0,450,100)
end
end
else
x = reply(msg,0)
end
if exitme = 1 then leave
end
x = cleardmrequest(w1)
/* a = freemenu(menustrip1) */
a = closewindow(w1)
a = closescreen(scr)
exit
/* -----------------------------------------------------------------------
get intui-message from requester
----------------------------------------------------------------------- */
getreqresponse:
reqexit = 0
do forever
if reqexit ~= 0 then leave
x = waitpkt(portname)
do forever
msg = getpkt(portname)
if msg = '0000 0000'x then leave
class = getarg(msg,0)
if class = REQCLEAR then reqexit = 1
if class = GADGETDOWN then
do
if getarg(msg,9) = 28 then /* if gadid=28 force endrequest */
do
say "Gagdet ID = " getarg(msg,9) "Forcing ENDREQUEST() "
reqexit = endrequest(req,w1)
end
end
rr = Reply(msg,0)
end
end
return 1